package team.se.tms.dto;

import lombok.Data;
import team.se.tms.annotation.Regex;
import team.se.tms.po.AuthorityInfo;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * 角色详情类
 *
 * @author winkyle
 * @date 2018/11/30
 */
@Data
public class RoleDetail implements Serializable,Cloneable{
    @Regex("^[A-Za-z0-9]{16}$")
    private String roleId;
    @Regex("^[\\u4e00-\\u9fa5]{1,8}$")
    private String roleName;
    private ArrayList<AuthorityInfo> authorityInfos;


    @Override
    public Object clone(){
        RoleDetail roleDetail = null;
        try {
            roleDetail=(RoleDetail)super.clone();
            //??List<AuthorityInfo>不能克隆？
            roleDetail.authorityInfos = (ArrayList<AuthorityInfo>)authorityInfos.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return roleDetail;
    }
}
